package com.school.manager.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.school.manager.domaim.SysUserRole;
import com.school.manager.entity.po.SysUserRolePo;
import com.school.manager.entity.vo.SysUserRoleVo;
import com.school.manager.mapper.SysUserRoleMapper;
import com.school.manager.service.ISysUserRoleService;
import com.school.manager.utils.PageUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * description：用户角色关联业务实现类
 * date：2021/10/133:18 下午
 */

@Service
@Slf4j
public class SysUserRoleMapperImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
	
	@Autowired
    private SysUserRoleMapper sysUserRoleMapper;
	
	@Override
	public Page<SysUserRoleVo> page(SysUserRolePo sysUserRolePo) {
		QueryWrapper<SysUserRole> queryWrapper = PageUtil.buildQueryWrapper(sysUserRolePo, SysUserRole.class);
        Page<SysUserRole> page = new Page<>(sysUserRolePo.getCurrent(), sysUserRolePo.getSize());
        sysUserRoleMapper.selectPage(page, queryWrapper);
        return PageUtil.buildPage(page, SysUserRoleVo.class);
	}
	

}
